Making your own Toolbar Buttons

In Icon Brush 2.5, the new toolbar made its debut. This toolbar allows you to place your own apple-scripts at the top of every overview window. When clicked, these scripts will perform whatever action you designed them to do. But there's more that can be done with these toolbar scripts. You can add a script to the toolbar by placing it inside the "Scripts" folder in the same folder as the Icon Brush application, and then dragging it into the toolbar.

Custom Icons
	By control-clicking on a script in the toolbar, you can select "Edit Icon" form the contextual menu. This allows you to make custom icons for your buttons.

Activate handler
	If your button only needs to be enabled under certain circumstances, you can add an 'activate' handler to your script. For example:

on activate {}
	tell application "Icon Brush"
		set The_Window to overview window 1 -- this is the frontmost window
		set Needs_To_Save to dirty of The_Window
		if Needs_To_Save then
			return true -- button enabled
		else
			return false -- button disabled
		end if
	end tell
end activate

Your activate handler will be called every time Icon Brush deems that it is necessary to re-evaluate the toolbar. This is usually when the current selection changes and when an overview window is brought to the front. You can open up some of the included scripts for examples of using the activate handler.

*** NOTE: I disabled the use of the activate handler in 2.5.0 because it was causing crashes with OS X 10.1.5. Once I get this worked out, i'll re-enable that feature in a maintenance release of Icon brush. ***